package com.wzq.solution;

import com.wzq.solution.node.TreeNode;

class Solution98 {

    long  last = -Long.MAX_VALUE;
    public boolean isValidBST(TreeNode root) {
        
        if(root == null){
            return true;
        }
        
        if(isValidBST(root.left)){
            if(root.val > last){
                last = root.val;
                return isValidBST(root.right);
            }
        }
        
       return false;
        
    }
}